package net.lainiao.mycost.controller;

import net.lainiao.mycost.utils.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/3/22.
 */
@Controller
@RequestMapping("/report/")
public class ReportController extends Page {
    @RequestMapping("salaryMonth.do")
    public String salaryMonthReport(Model model, String type) {
        List<Map> list = reportService.salaryMonthReport();
        model.addAttribute("list", list);
        if ("column".equals(type)) {
            return "report/report_salarymonth_column";
        } else if ("line".equals(type)) {
            return "report/report_salarymonth_line";
        } else {
            return "report/report_salarymonth";
        }
    }

    @RequestMapping("expenseMonth.do")
    public String expenseMonthReport(Model model,String type){
        List<Map> list=reportService.expenseMonthReport();
        model.addAttribute("list",list);
        if("column".equals(type)){
            return "report/report_expense_column";
        }else if("spline".equals(type)){
            return "report/report_expense_spline";
        }else{
            return "report/report_expense";
        }
    }

    @RequestMapping("expenseCost.do")
    public String expenseCostReport(Model model,String type){
        List<Map> list=reportService.expenseCostReport();
        model.addAttribute("list",list);
        if("pie".equals(type)){
            return "report/report_expensecost_pie";
        }else if("column".equals(type)){
            return "report/report_expensecost_column";
        }else if("spline".equals(type)){
            return "report/report_expensecost_spline";
        }else{
            return "report/report_expensecost";
        }
    }
}
